<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = [1, 1, 1, 2, 2, 3, 3, 3, 3, 3]
			// 方法1
			var set = new Set(arr)
			var newArr = [...set]
			console.log(arr,newArr)
			// 方法2
			function repe (oldArr) {
				var obj = {}
				for (var item of oldArr) {
					obj[item] = 1
				}
				var newArr = []
				for (var key in obj) {
					newArr.push(parseInt(key))
				}
				return newArr
			}
			var newArr = repe(arr)
			console.log(arr,newArr)
		</script>
	</body>
</html>
